"use client"; import Sidebar from "@/components/Layout/Sidebar"; import { useSystemStore } from "@/stores/useSystemStore"; import { ConfigProvider, Mask } from "antd-mobile"; import ptBR from "antd-mobile/es/locales/pt-BR"; import { ThemeProviderProps } from "next-themes/dist/types"; import { ReactNode, useEffect, useMemo, useState } from "react"; import { server } from "@/utils/client"; import { useDebounceEffect, useRequest } from "ahooks"; import clsx from "clsx"; import { initializeApp } from "firebase/app"; import { getMessaging, getToken, onMessage } from "firebase/messaging"; import { usePathname, useSearchParams } from "next/navigation"; import Script from "next/script"; import { setupFontSize } from "@/utils"; import { Local } from "@/utils/storage"; import { motion } from "framer-motion"; import Image from "next/image"; import styles from "./style.module.scss"; export interface ProvidersProps { children: ReactNode; themeProps?: Omit; } // 初始化 fireBase const initFirebase = () => { // 是否是https if (document.location.protocol.indexOf("https") === -1) return; // 浏览器是否支持 且是 pwa if (!window.Notification) { return; } // 是否开启通知 // new Notification("这是标题", { // body: "这是正文", // icon: "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png", // requireInteraction: true, // image: "https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png", // }); if (Notification.permission === "default") { // 征求用户的许可 Notification.requestPermission(); } if (Notification.permission === "denied") return; const app = initializeApp({ apiKey: process.env.NEXT_PUBLIC_FIREBASE_APIKEY, authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTHDOMAIN, projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECTID, storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGEBUCKET, messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGINGSENDERID, appId: process.env.NEXT_PUBLIC_FIREBASE_APPID, measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENTID, }); const messaging = getMessaging(app); // 针对单机测试,或者服务端需要使用这个key可以放开 // if (process.env.NODE_ENV === "development") { getToken(messaging, { vapidKey: process.env.NEXT_PUBLIC_FIREBASE_KEYS, }).then((res) => {}); // } onMessage(messaging, (payload) => { const notifica = new Notification(payload.data?.title || "", { body: payload.data?.body, icon: payload.data?.image, ...payload.data, }); }); }; /** * 获取停服公告信息 * POST /v1/api/front/suspension * 接口ID:263127760 * 接口地址:https://app.apifox.com/link/project/4790544/apis/api-263127760 */ interface SuspensionType { able: boolean; } const getStopServiceApi = () => { return server .post({ url: "/v1/api/front/suspension", data: { renter_id: "10000" }, }) .then((res) => { return res.data.able ?? false; }); }; /** * @description 停服通知 */ const StopServiceClient = () => { const { data: isSuspension } = useRequest(getStopServiceApi, { pollingInterval: 10000, pollingErrorRetryCount: 3, }); return ( <> {isSuspension && (
O site está prestes a parar de ser atualizado, a fim de proteger a segurança de seus fundos, temporariamente impossibilitado de fazer apostas
)} ); }; /** * @description 全局弹窗 */ const GlobalNotify = () => { const [visible, setVisible] = useState(false); return ( <> setVisible(false)}>
{/*内容*/}

GANHE UM BÔNUS DE

999.00

{/*title*/} {""} {/*铃铛*/} {""} {/*金币*/} {""} {/*光*/} {""} {""} {/*背景*/} {""}
); }; /** * @description 初始化pixel广告追踪 * * 1:获取url参数 * - 如果 有url参数获取并存入本地缓存 * - 如果 没有url参数获取本地缓存 * 2:根据类型获取对应的id */ //bcwin?ch=ugZ8z9mf8x&type=kwai_pixel&kwaiPixel=2222 fbPixel kwaiPixel // bcwin11111?ch=TcC4Wno4Cq&type=facebook_pixel&fbPixel=625811426763645 // kwai 271573370973328 /** * @description type * 1: kwai_pixel * 2: facebook_pixel */ const InitAdvertise = () => { const pathname = useSearchParams(); // pixel 类型 const [pixelType, setPixelType] = useState(null); const [pixelId, setPixelId] = useState(null); // 快玩id const kwaiPixel = pathname.get("kwaiPixel"); const kwaiClick_id = pathname.get("click_id"); // facebook id const facebookPixel = pathname.get("fbPixel"); // console.log( // `🚀🚀🚀🚀🚀-> in providers.tsx on 152`, // typeof window, // typeof window !== undefined ? window.localStorage.getItem("pixel_type") : "" // ); useEffect(() => { if (kwaiPixel) { setPixelType("kwai_pixel"); Local.setKey("ban_pixel_type", "kwai_pixel"); Local.setKey("ban_pixel_id", kwaiPixel); } else if (facebookPixel) { setPixelType("facebook_pixel"); Local.setKey("ban_pixel_type", "facebook_pixel"); Local.setKey("ban_pixel_id", facebookPixel); } else { const type = Local.getKey("ban_pixel_type"); setPixelType(type); } if (kwaiClick_id) { Local.setKey("ban_click_id", kwaiClick_id); } setPixelId(kwaiPixel || facebookPixel || Local.getKey("ban_pixel_id")); }, []); return ( <> {pixelType === "facebook_pixel" && ( )} {pixelType === "kwai_pixel" && ( )} ); }; export default function SidebarLayout({ children, themeProps }: ProvidersProps) { const { isCollapse, setCollapse } = useSystemStore((state) => ({ isCollapse: state.isCollapse, setCollapse: state.setCollapse, })); const pathname = usePathname(); const isShowBg = useMemo(() => { const local = pathname.split("/")[1]; if (`/${local}` === pathname) return true; return [ `/${local}/freeGames`, `/${local}/replayGames`, `/${local}/promo`, `/${local}/gameList`, ].includes(pathname); }, [pathname]); return (
{/* Main Content transform: translate(0, 0);*/}
{ setCollapse(false); }} >
{/*停服通知*/} {/*充值成功通知*/}
{children}
); } export const Providers = ({ children, themeProps }: ProvidersProps) => { const setupConfig = useSystemStore((state) => state.setupConfig); useDebounceEffect(() => { if ("serviceWorker" in navigator) { initFirebase(); } // 初始化配置 setupConfig(); // 初始化字体 setupFontSize(); }, []); return ( {children} ); };